<template>
  <div class="classifypage">
    <van-search v-model="value" placeholder="请输入搜索关键词" />
    <van-grid
      :column-num="4"
      :border="false"
    >
      <van-grid-item v-for="(item,i) in list" :key="i" :to="{ path: '/goods/goodlist',query: { cid: item.id, title:item.cate_name }}">
          <van-image
          width="0.8rem"
          height="0.8rem"
          lazy-load
          :src="item.pic"
        />
        <div>{{item.cate_name}}</div>
      </van-grid-item>
    
    </van-grid>
    <Basetabbar :active="1" />
  </div>
</template>
<script>
import { getcategory } from '@/api/goods.js'
export default {
  data() {
    return {
      list:[],
      value:null
    }
  },
  created() {
    this.getdata()
  },
  methods: {
    async getdata() {
      try {
        const back = await getcategory()
        if (back.status == 200) {
          this.list=back.data
        }
      } catch (err) {
        console.error(err)
      }
    },
  }

}
</script>

<style>
</style>